<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<html>
<body class="easyui-layout list_body">
	<form id="stlMchntForm" name="stlMchntForm">
		<div class="list_body_north" data-options="region:'north'" border="false">
			<!-- 查询表单 -->
			<div style="padding: 3px" class="easyui-panel datagrid-toolbar">
				<div>
					<span>清算开始日期:</span>
					<input type="text" value="${yestedayDate}" name="beginDate" class="easyui-datebox" data-options="editable:false"/>
					<span>清算结束日期:</span>
					<input type="text" value="${yestedayDate}" name="endDate" class="easyui-datebox" data-options="editable:false"/>
					<span>会员编号:</span>
					<input type="text" name="custom_no" class="easyui-textbox"/> 
					<span>会员名称:</span> 
					<input type="text" name="name" class="easyui-textbox"/> 
					<br/>
					<span>手机号:</span>
					<input type="text" name="login_id" class="easyui-textbox"/> 
					<span>机构号:</span>
					<input type="text" name="ins_cd" class="easyui-textbox"/> 
					<a href="#" class="easyui-linkbutton btn" iconCls="icon-search" onclick="doSearch()">查询</a> 
					<a href="#" class="easyui-linkbutton btn" iconCls="icon-reload" onclick="resetForm()">重置</a>
				</div>
			</div>
			<!-- 维护汇总数据 -->
			<div style="padding: 3px" class="easyui-panel datagrid-toolbar">
				交易总金额：<span id="AMT"></span>&nbsp;&nbsp;
				会员手续费汇总：<span id="MIDFEE"></span>&nbsp;&nbsp;
				会员结算手续费汇总：<span id="CUSTOM_STL_FEE"></span>&nbsp;&nbsp;
				机构结算手续费汇总：<span id="INS_STL_FEE"></span>&nbsp;&nbsp;
				交易分润毛利汇总：<span id="PROFIT_FEE"></span>
			</div>
			<jiepos:buttonOperateTag menuCode="${menuCode }"></jiepos:buttonOperateTag>
		</div>
		<div data-options="region:'center'" border="false" class="list_body_center">
			<!-- 表格 -->
			<table id="stlMchntTableId" fit="true"></table>
		</div>
	</form>
</body>
<script type="text/javascript">
	var grid;
	$(function() {
		/*加载表格数据*/
		grid = $("#stlMchntTableId").jpgrid({
			url : "stlMchntJsonForIns.do",
			baseColumns: false,
			columns : [
				{title : "清算日期", field : "STL_DT", align : 'center', width:80}, 
				{title : "会员编号", field : "CUSTOM_NO", align : 'center', width:150},
				{title : "会员名称", field : "CUSTOM_NAME", align : 'center', width:150},
				{title : "所属机构", field : "INS_NAME", align : 'center', width : 230},
				{title : "业务名称", field : "SERVICE_NAME", align : 'center',width : 120},
				{title : "业务参数名称", field : "PARAM_NAME", align : 'center', width : 160},
				{title : "交易笔数", field : "CNT", align : 'center', width:80},
				{title : "交易金额", field : "AMT", align : 'center', width:100},
				{title : "会员手续费", field : "MIDFEE", align : 'center', width:100},
				{title : "会员结算手续费", field : "CUSTOM_STL_FEE", align : 'center', width:100},
				{title : "机构结算手续费", field : "INS_STL_FEE", align : 'center', width:100},
				{title : "交易分润毛利", field : "PROFIT_FEE", align : 'center', width:100}
            ],
            onLoadSuccess: getTotalInfo
		});
	});

	function doSearch() {
		grid.load(getQueryParams());
	}
	
	/*获取汇总数据*/
	function getTotalInfo(data){
		$.jpajax({
			url: "${pageContext.request.contextPath}/logStlmChntSum/stlMchntSumForIns.do",
			data: getQueryParams(),
			success: function(result){
				if(result){
					for(var key in result){
						$("#" + key).text(result[key]);
					}
				}
			}
		});
	}
	/*获取查询条件参数*/
	function getQueryParams(){
		var array = $("#stlMchntForm").serializeArray(), params = {};
		$.each(array, function(i, param){
			params[param.name] = param.value;
		});
		return params;
	}

	function exportFile(url){
		commonFileDownload(url, "stlMchntForm");
	}
</script>
</html>
